// Package test contains predefined set of Keys for testing. Generating private
// keys is computationally expensive, which slows down tests dramatically.
// Using a cache of pre-calculated private keys defined here keeps tests fast.
package test

import (
	"encoding/base64"
	"fmt"

	crypto "github.com/libp2p/go-libp2p-core/crypto"
	peer "github.com/libp2p/go-libp2p-core/peer"
	"github.com/qri-io/qri/auth/key"
)

// EncodedKey holds encoded private keys and keyIDs
type EncodedKey struct {
	B64PrivKey string
	B58PeerID  string
}

// KeyData holds decoded keys and keyIDs
type KeyData struct {
	PrivKey crypto.PrivKey
	KeyID   key.ID
	// TODO(b5): this should be removed
	PeerID         peer.ID
	EncodedPrivKey string
	EncodedPeerID  string
}

var (
	cache   []KeyData
	encoded = [...]EncodedKey{
		// RSA keys: indexes 0-10
		{"CAASqAkwggSkAgEAAoIBAQChp1HiZxTsLQCaHmW3/cc2ZDZpgLwn5o1/nZPgqT7SyXHP5bn7GQMG3kPEQWcl4nhtLX9hkrBEskHrdIlqp9zXFMwBfat+qfzCylGC/QBDF7wT9umLd7nbq7pAxQXteXgntt2Zhg4gE/kEk7vIyL+P9KpWJZ/yjpykgsDC7NPnrr8qZBo2tL0F4w+33nZhEx7Pp7Rnaq22JM8rF+NHCgSkUh63lp7Vhwm9PQoGtt0XTnEKxrMQnUme/IhGNxs84RphxHc5+nW6jYjgm5bcJonGyPU7bq+v51Mr2Ol4RT3L9ZNJgz0SWTSmAtiBLx2ryLrTjmDPSvN7wLm9sWEdWmRVAgMBAAECggEBAJMumrl+jWgz2TZ5sreBEp6NQ5VvpuDVY8PrnzaQIikdTMizK1BaB417VUwdGGM//dG5+R7HxkHl42sT4gH/8GzL/Krm1vwunXplZy3SWSi9NXsf9qgLTGebxasvOCRt0l6mesFLcxT12ma2c+VuEixp4aUqAKWB/1Ex03wm0RFBcSttPHe5ODW8Eaz+ZU8cpObEcZdCIPVxeWqLVdkAImOmsknL0EAxP8Wo/V6Rh5Cg4PnwnfJiQ45C+m6h7NTIw0H4UOncv7EBABra6LqF6Uoda9vmv8Cpwa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/yLxur4ry1eNYty/9FnuZRAkEmlUSZ/DobhU0Pmj8Hep6JsTuMutref6vCk2n02jc9qYmJuD7iXkdXDSawbEG6f5C4MUkJ38z1t1OjA==", "QmZePf5LeXow3RW5U1AgEiNbW46YnRGhZ7HPvm1UmPFPwt"},

		// Ed25519 Keys: indexes 11-20
		{"CAESQHldkQO4sgNhj8Lz6LbMWRASHcBVz8Y2k3/8oCQghi08evAKi9Oi217CTGVkiahHRIyH8Q30VsLFkHxfvArZoeg=", "12D3KooWJ6GCePsjZoSPzakvjbz2JYpiL7hQQdWwUuNiDegecUMm"},
		{"CAESQOrObwc4rSHH8gOCzfHXb5LSag0TouffKaDM2gXiEsBF2PVu817CDtdvDB9c2vEpwX2m17I4iqLV1mTM3sxY52Y=", "12D3KooWQRHJ1WQeV3dDuzpv6BrsAHMUWmHP3bK55DXsJkfA5isX"},
		{"CAESQEhmGGOuDZkDmYwLDk/jcohYca+SaLWG5s/ThN7T+xpRyayJNWssx5ytt9MOrJyqfTiYbTWXivyllDSVFMTQ77o=", "12D3KooWPPci17oLe9AAN94G148XZNQLcpf13eFahxCssnj2t8Am"},
		{"CAESQAZOQQ4zYUith5GeZeK1Av/qLdTYtHPHnCbrkppspA1/bpaoeif5r6ByFto2FIJw4Ifg21XSArDe4FHgdCBodnE=", "12D3KooWHG4FwPY7GY1q8mC6MUZMV6oH1nMrC6FnrdPpX6f2q3MJ"},
		{"CAESQJNZDuXHhzSfSC5BJ7AZ3QYBpZPgEgxJPSF01RJpMIwcHSYSdW7VryNLDIoLdJx5y5JdZ0krESa8Vf7DI8zNXaA=", "12D3KooWBn9fRHQbnde8nugH73ZS8gUfAKtCKztNWk5Z4q6pL679"},
		{"CAESQCnvL2nMM8C+Qr8HZsFRn+eTswnFIZT6kPAakq24u7cV27pv6Iq9Slxixn8rE5MYSvYCpPU11oOUDNgpC0V4seM=", "12D3KooWQc6Lhwf5PABQyXC8j78h9XQGLpZk3LFZqqdBa3RJtHtE"},
		{"CAESQDbSB/b5+EjhP4HvPfbDJEQUPrOG6Jd3yuUqfGkrVvRzw2uE/uqcQfKdQIgZE34znph95krvwxY7gKzU1y4ipmA=", "12D3KooWNyCm5AzpeHwRCTCg8u7cKnERNKsvcmeJBimwWkYcVKWP"},
		{"CAESQG9syvhCZW1rYD0Ze2lhuElJpB9p25NPmpo/Rz0drLfe/le8hKRBJmeaBrx0qkH1+UXAt5XrdtpX2PG/sQ5E1UA=", "12D3KooWSwDKRt666mnTTd1DaJ6YucNFPRndMCrdpAzzNAoAs4TH"},
		{"CAESQJj5iNGV60dIoFhF3Q9Z4ayg0SzFWSYe5ebYQABnqeGwnIvDg519Hz7+PxuPN4Mci6eI6pNDRuJT8r4tvNRBIVU=", "12D3KooWLMTNqrqhVFmP5nfEHXnZ73MAMZFVCAWSkAMrsk6fV1jr"},
		{"CAESQMYq8tJTQGzbwGsQvb+2aeM7ErJzu8cmJg68QPSyst2HWbJq0NogN4MixYYNXS3DuUvAqd6hy3nLr68rdKZewdY=", "12D3KooWFrWFHGLwmMGqhZRjCrfiSbXxpnibcqDizwn7mW7MdJCM"},
	}
)

// GetKeyData gets Private Key data for testing
func GetKeyData(i int) *KeyData {
	if i >= len(encoded) {
		panic(fmt.Sprintf("exhausted the available test peers! Requested #%d but only %d exist", i, len(encoded)))
	}
	if cache == nil {
		cache = make([]KeyData, len(encoded))
	}
	info := &cache[i]
	if len(info.PeerID) == 0 {
		e := encoded[i]
		data, err := base64.StdEncoding.DecodeString(e.B64PrivKey)
		if err != nil {
			panic(err)
		}
		pk, err := crypto.UnmarshalPrivateKey(data)
		if err != nil {
			panic(err)
		}
		kid, err := key.DecodeID(e.B58PeerID)
		if err != nil {
			panic(err)
		}

		pid, err := peer.Decode(e.B58PeerID)
		if err != nil {
			panic(err)
		}
		info.PrivKey = pk
		info.PeerID = pid
		info.KeyID = kid
		info.EncodedPrivKey = e.B64PrivKey
		info.EncodedPeerID = e.B58PeerID
	}
	return info
}
